package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 套餐内菜品数据持久层
 */
public interface SetmealDishMapper {

    /**
     * 批量插入口味菜品数据
     * @param setmealDishList
     * @return
     */
    int addBatchSetmealDish(@Param("setmealDishList")List<SetmealDish> setmealDishList);

    /**
     * 根据套餐id查询套餐内所有菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> findSetmealDishListBySetmealId(long id);

    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(long id);


    int findDishIsExist(@Param("ids") Long[] ids);
}
